package com.ruix.app.ui.adapter;

import android.content.Context;

import com.ruix.app.R;
import com.ruix.app.adapter.superadapter.SuperAdapter;
import com.ruix.app.adapter.superadapter.internal.SuperViewHolder;
import com.ruix.app.model.PurseRecord;


/**
 * Created by hadexs on 2017/7/19.
 */

public class PurseRecordAdapter extends SuperAdapter<PurseRecord> {


    public PurseRecordAdapter(Context context) {
        super(context, R.layout.item_purse_record_detail);
    }

    @Override
    public void onBind(SuperViewHolder holder, int viewType, final int position, final PurseRecord item) {
        holder.setText(R.id.tv_title,item.getTitle());
        holder.setText(R.id.tv_create_time,item.displayTime());
        if ("1".equals(item.getType())){ //收入
            holder.setTextColor(R.id.tv_money,0XFFFF6565);
            String inMoney = "+"+item.moneyString();
            holder.setText(R.id.tv_money,inMoney);
        } else { //支出
            holder.setTextColor(R.id.tv_money,0xFF999999);
            String outMoney = "-"+item.moneyString();
            holder.setText(R.id.tv_money,outMoney);
        }
//        holder.setText(R.id.tv_money,item.moneyString());

    }
}
